<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<input type="text" onkeydown="downfn()" onkeyup="upfn()">
<script type="text/javascript">
function downfn(){
	//event事件对象 keyCode按键编码
	console.log("键盘按下"+event.keyCode)
}
function upfn(){
	var str=String.fromCharCode(event.keyCode);
	console.log("键盘抬起")
}
</script>
</body>
</html>